package va_file;

import java.io.IOException;

import bufmgr.HashEntryNotFoundException;
import bufmgr.InvalidFrameNumberException;
import bufmgr.PageNotReadException;
import bufmgr.PageUnpinnedException;
import bufmgr.ReplacerException;
import va.BaseNNIndexScan;
import global.Vector100Dtype;
import global.IndexType;
import global.AttrType;
import heap.FieldNumberOutOfBoundException;
import heap.HFBufMgrException;
import heap.HFDiskMgrException;
import heap.HFException;
import heap.InvalidTupleSizeException;
import heap.InvalidTypeException;
import index.IndexException;
import iterator.FileScanException;
import iterator.FldSpec;
import iterator.CondExpr;
import iterator.InvalidRelation;
import iterator.JoinsException;
import iterator.PredEvalException;
import iterator.TupleUtilsException;
import iterator.UnknowAttrType;
import iterator.WrongPermat;

public class NNIndexScan extends BaseNNIndexScan {

	public NNIndexScan(IndexType index,
						String relName,
						String indexName,
						AttrType[] types,
						short[] str_sizes,
						int noInFields,
						int noOutFields,
						FldSpec[] outFields,
						CondExpr[] selects,
						int fldNum,
						Vector100Dtype target,
						int count,
                        int noOfBits) throws IndexException, HFException, HFBufMgrException, HFDiskMgrException, IOException, InvalidTupleSizeException, PageUnpinnedException, InvalidFrameNumberException, HashEntryNotFoundException, ReplacerException, InvalidTypeException, FileScanException, TupleUtilsException, InvalidRelation, JoinsException, PageNotReadException, PredEvalException, UnknowAttrType, FieldNumberOutOfBoundException, WrongPermat {
		super(index, relName, indexName, types, str_sizes, noInFields, noOutFields, outFields, selects, fldNum, target, count, noOfBits);

		VAFile file = new VAFile(indexName);
		VAFileScan scan = file.openVAScan();
		this.rids = scan.VAFileNNScan(target, count, noOfBits);
        scan.close();
	}

}
